package com.marvels.approve.process.api.hystrix;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.marvels.approve.process.api.ApplyProvideConsumerApi;
import com.marvels.approve.process.dto.LaAttachAtmeTypeViewDTO;
import com.marvels.common.exception.MarvelsBusinessException;
import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.loanapply.api.LoanapplyAttachAchieveApi;

import cn.hutool.core.bean.BeanUtil;

@Service
public class ApplyProvideConsumerApiHystrix implements ApplyProvideConsumerApi{
	
	@Autowired
	private LoanapplyAttachAchieveApi attachAchieveApi;
	
	@Override
	public List<LaAttachAtmeTypeViewDTO> getAttachAtmeTypeInfo(LaAttachAtmeTypeViewDTO laAttachAtmeTypeViewDTO)throws MarvelsBusinessException {
		//转换参数
		com.marvels.loanapply.dto.LaAttachAtmeTypeViewDTO param = new com.marvels.loanapply.dto.LaAttachAtmeTypeViewDTO();
		BeanUtil.copyProperties(laAttachAtmeTypeViewDTO, param);
		//调用目标方法，并转换成需要的对象
		List<com.marvels.loanapply.dto.LaAttachAtmeTypeViewDTO> apiResult = attachAchieveApi.getAttachAtmeTypeInfo(param);
		List<LaAttachAtmeTypeViewDTO> result = JSONObject.parseArray(JSONObject.toJSONString(apiResult), LaAttachAtmeTypeViewDTO.class);
		MarvelsLogUtil.getInstance().info("ApplyProvideConsumerApi.getAttachAtmeTypeInfo direct call success!");
		return result;
	}

}
